<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2023/4/15
  Time: 14:52
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>管理员登录</title>
    <style>
        body{
            background-image: url("${pageContext.request.contextPath}/admin_img/bg.jpg");
        }
        .mainDiv{
            border: 1px solid #000;
            width: 650px;
            height: 350px;
            border-radius: 3.5px;
            margin: 100px 0 0 350px;
        }
        .userDiv{
            margin: 40px 0 0 60px;

        }
       /* #username{
            margin-left: 20px;
        }*/
     /*   .pwdDiv{
            margin: 20px 0 0 60px;
        }
        #pwd{
            margin-left: 20px;
        }
        .repwdDiv{
            margin: 20px 0 0 60px;
        }
        #repwd{
            margin-left: 12px;
        }
        .emailDiv{
            margin: 20px 0 0 60px;
        }
        #email{
            margin-left: 20px;
        }

        .btnDiv{
            margin: 20px 0 0 170px;
        }*/
    </style>

    <%--导入bootstrap的css全局样式/js库--%>
    <link href="${pageContext.request.contextPath}/css/bootstrap.min.css"  rel="stylesheet"/>
    <script src="${pageContext.request.contextPath}/js/jquery-3.4.1.min.js"></script>
    <script src="${pageContext.request.contextPath}/js/bootstrap.min.js"></script>
</head>
<body>

<div class="mainDiv">


    <!--action:提交的服务器地址-->
    <%--<form action="${pageContext.request.contextPath}/admin_Login" method="post">
        <div class="userDiv">
            <label for="username">用户&ensp;名</label>
            <input type="text" name="username"    placeholder="请输入用户名"
                   id="username" /><span id="userTip"></span>
        </div>
        <div class="pwdDiv">
            <label for="pwd">密&ensp;&ensp;&ensp;码</label>
            <input type="password" name="password"
                   placeholder="请输入密码" id="pwd" /><span id="pwdTip"></span>
        </div>

        <div class="pwdDiv">
            <label for="code">验证码</label>
            <input type="text" style="margin-left: 20px;" name="code"
                   placeholder="请输入验证码" id="code" />
            <img id="img1"  src="${pageContext.request.contextPath}/checkCode" onclick="clickImg()">
        </div>
        <div class="btnDiv">
            <!--submit:表单提交:将表单中所有数据提交服务器服务器上-->
            <input type="submit" value="登录">
        </div>

    </form>
--%>

    <form class="form-horizontal" action="${pageContext.request.contextPath}/admin?methodName=adminLogin" method="post">
        <div class="form-group" style="margin-top: 30px;margin-right:30px; " >
            <label for="username" class="col-sm-3 control-label">用户名称</label>
            <div class="col-sm-9" >
                <input type="text" name="username"  class="form-control"  id="username" placeholder="请输入用户名">
            </div>
        </div>
        <div class="form-group" style="margin-right: 30px;margin-top: 20px;">
            <label for="password" class="col-sm-3 control-label">用户密码</label>
            <div class="col-sm-9">
                <input type="password" name="password" class="form-control" id="password" placeholder="请输入密码">
            </div>
        </div>

        <div class="form-group" style="margin-right: 170px;margin-top: 20px;">
            <label for="code" class="col-sm-4 control-label">验证码</label>
            <div class="col-sm-4">
                <input type="text" name="code" class="form-control" id="code" placeholder="请输入验证码">
            </div>
            <img class="col-sm-4" onclick="clickImg()"  id="img1" src="${pageContext.request.contextPath}/checkCode">
        </div>

        <div class="form-group" style="margin-left: 100px;">
            <div class="col-sm-offset-2 col-sm-10">
                <div class="checkbox">
                    <label>
                        <input type="checkbox"> Remember me
                    </label>
                </div>
            </div>
        </div>
        <div class="form-group" style="margin-left: 100px;">
            <div class="col-sm-offset-2 col-sm-10">
                <button type="submit" class="btn btn-default">Sign in</button>
            </div>
        </div>
    </form>
    <center><span style="color: red;font-size: 20px;">
    ${msg}
  </span></center>
</div>

</body>
<script>

        //点击图片刷新
        function clickImg(){
           // alert("点击图片") ;
            //原生Js的dom操作
            //获取id="img1"的标签对象
            var img = document.getElementById("img1") ;

            //改变src属性
            img.src="${pageContext.request.contextPath}/checkCode?newDate="+new Date();
        }

</script>
</html>
